package com.xdf.vpndialer.utils;

import com.xdf.vpndialer.service.ExecExtFile;
import com.xdf.vpndialer.service.VpnDialer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Configuration
@EnableScheduling
@Slf4j
public class Schedule {

    @Autowired
    private VpnDialer dialer;

    @Autowired
    private ExecExtFile execExtFile;

    // 24小时不间断每10分钟检测以此VPN联通状态
    @Scheduled(cron = "0 0/10 * * * ?")
    public void uploadProcess() throws Exception {
        dialer.connectVPN();
    }

//    @Scheduled(cron = "0/7 * * * * ?")
    public void printPath() throws Exception {
//        String path = execExtFile.getPath();
//        log.info(path);
    }
}
